package client;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.MediaTracker;
import javax.swing.JPanel;


public class BackgroundPanel extends JPanel {
	private static final long serialVersionUID = 1L;
	
	/**
	 * E' l'immagine di sfondo del pannello
	 */
	private Image image;
	
	public BackgroundPanel(Image image) {
		this.image = image;
		MediaTracker mediaTracker = new MediaTracker(this);
		mediaTracker.addImage(image, 1);
		try {
			mediaTracker.waitForID(1);
		} catch(InterruptedException e) {
		}
	}
	
	protected void paintComponent(Graphics graphics) {
		super.paintComponent(graphics);
		graphics.drawImage(image, 0, 0, null);
	}
	
}
